package cn.pkg.controller;

import cn.pkg.entities.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class testController {
    @Autowired
    private RedisTemplate redisTemplate;
    @GetMapping("/test")
    public  Object get(){
//            redisTemplate.delete()
//        System.out.println(String.valueOf(redisTemplate.opsForValue().get("li"))+"更新前");
        List<Object> list = new ArrayList<>();
        Emp emp = new Emp();
        emp.setContent("asd-asdasdasd");
        list.add(emp);
        redisTemplate.opsForList().rightPushAll("li",list);
        redisTemplate.opsForList().range("li",0,-1);

        return "ok" ;
    }
}
